#NPCID
global NPCID
#捐 赠 包 ID
global ShouNBID

NPCID = 0x00000083
ShouNBID = 0x44BB27D4
feishu = 0x4454759E


def juanshu():
    Misc.Pause(1000)
    Items.UseItem(feishu)
    Gumps.WaitForGump(1431013363, 10000)
    Gumps.SendAction(1431013363, 35)
    Misc.Pause(2000)
    Mobiles.UseMobile(0x00000083)
    Gumps.WaitForGump(Gumps.CurrentGump(), 10000) 
    Gumps.SendAction(Gumps.CurrentGump(), 1115606) 
    Misc.WaitForPrompt(1000)
    Target.TargetExecute(ShouNBID)  
    Gumps.WaitForGump(Gumps.CurrentGump(), 10000) 
    Gumps.SendAction(Gumps.CurrentGump(), 9999)
    
def zhengli():
    yuan = Items.FindBySerial(Player.Backpack.Serial)
    Misc.Pause(1000)
    for wupin in yuan.Contains:
        if wupin.ItemID == 0xf47:
            Misc.Pause(200)
            Items.Move(wupin,ShouNBID,1)
            Misc.Pause(450)

            
NPCsz = [0x0007ACA6,0x0007ACA1,0x0007AEE5,0x0007AEBF,0x000ACE71,0x000ACBB2,0x000ACF35,0x000ACBD9,0x000AEF72,0x000AEED4,0x0007A171,0x0007A17F,0x0005E43E,0x0005E437]  
FuShi = [5,5,5,5,11,11,11,11,17,17,23,23,29,29]          
            
while True:
    #feidianshu = len(NPCsz)
    for i in range(14):
        Misc.Pause(1000)
        Items.UseItem(feishu)
        Gumps.WaitForGump(1431013363, 10000)
        Gumps.SendAction(1431013363, FuShi[i])
        Misc.Pause(2000)
        
        #buynpcid = Mobiles.FindBySerial(NPCsz[i])    
        Misc.WaitForContext(NPCsz[i], 10000)
        Misc.ContextReply(NPCsz[i], 1)
        Misc.Pause(2000)
        
        if Player.Weight > 103:
            zhengli()
            Misc.Pause(600)
            zhengli()
            Misc.Pause(600)
            juanshu()
            Misc.Pause(1000)

    